package com.automation.entity;

import com.automation.service.AppiumUtils;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

public class BasePage {
    protected AndroidDriver driver;

    public BasePage(AndroidDriver driver) {
        this.driver = driver;
    }

    protected void click(By locator) {
        AppiumUtils.waitForElement(driver, locator, 30).click();
    }

    protected void sendKeys(By locator, String text) {
        WebElement el = AppiumUtils.waitForElement(driver, locator, 15);
        el.clear();
        el.sendKeys(text);
    }

    protected String getText(By locator) {
        return AppiumUtils.waitForElement(driver, locator, 15).getText();
    }
}